package jf.jufanzhibo.view;

import android.support.v4.app.Fragment;
import android.util.SparseArray;



import jf.jufanzhibo.view.Main.MineFragment;
import jf.jufanzhibo.view.Signt.SigntFragment;
import jf.jufanzhibo.view.home.view.HomeFragment;


public class FragmentFactory {
    private static final int FRAGMENT_HOME = 0;
    private static final int  FRAGMENT_SIGHT = 1;
    private static final int FRAGMENT_MAIN = 2;
    private static SparseArray<Fragment> list = new SparseArray<>();

    public static Fragment setFragment(int key) {
        Fragment fragment = list.get(key);
        if (fragment == null) {
            switch (key) {
                case FRAGMENT_HOME:
                  fragment=HomeFragment.setFragment();
                    break;
                case FRAGMENT_SIGHT:
                    fragment = SigntFragment.setFragment();
                    break;
                case FRAGMENT_MAIN:
                    fragment = MineFragment.setFragment();
                    break;

            }
            list.put(key,fragment);
        }
        return fragment;
    }
}
